// import dotenv from 'dotenv';
import web3 from './web3.js';
import fs from 'fs';
import path from 'path';

dotenv.config({ path: './.env' });

const contractName = 'MedicalRecord';
const address = process.env.VITE_MEDICALRECORD_ADDRESS;

const abi = fs.readFileSync(path.join('../', 'abis', `${contractName}.json`), 'utf8');
console.log(abi);

const medicalRecord = new web3.eth.Contract(abi, address);
export default medicalRecord;